<?php

class ClubController extends Core_Controller_Action 
{

	public function init() {
		$this->view->menuType = -1;
		$this->view->offManufacturers = true;
	}

	public function indexAction() {
		
		$News = new News();
		$this->view->text = $News->getItemService( 33 )->getFirst();
		
		if( $this->_request->isPost() ) {
		
			$post = $this->_request->getPost();

			$b  = '<b>Imie</b>: ' . $post['name'] . '<br />';
			$b .= '<b>Nazwisko</b>: ' . $post['surname'] . '<br />';
			$b .= '<b>Email</b>: ' . $post['email'] . '<br />';
			$b .= '<b>Telefon</b>: ' . $post['phone'] . '<br />';
			$b .= '<b>Data urodzenia</b>: ' . $post['birthday_day'] . '-' . $post['birthday_month'] . '-' .$post['birthday_year'] . '<br />';
			$b .= '<b>Miasto</b>: ' . $post['locality'] . '<br />';
			$b .= '<b>Ulica</b>: ' . $post['street'] . '<br />';
			$b .= '<b>Numer domu i lokalu</b>: ' . $post['nr_home'] . '<br />';
			$b .= '<b>Kod pocztowy</b>: ' . $post['zip'];
			
			
			$mail = new Core_Mail();
			$mail->addTo( 'a3j6exm@gmail.com', 'Carnauba' );
			$mail->setFrom( $post['email'], $post['email'] );
			$mail->setSubject( 'Zgłoszenie do kluby Carnauba' );
			$mail->setBodyText( strip_tags( $b ) );
			$mail->setBodyHtml( $b );
			$mail->send();
			
			$this->view->sendInfo = true;
		}
	}

}